<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <link href="css/mui.min.css" rel="stylesheet"/>
    <link href="css/iconfont.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="../css/app.css"/>
    <style type="text/css">
		/*下面两项是重置muicss的输入框label和input之间的宽比率*/
		.mui-input-row label {
			width: 20%;
		}
		.mui-input-row label~input {
			width: 80%;
		}
		.mui-input-row label~select {
			width: 80%;
		}
   </style>
</head>
	<body>
		<div class="mui-content">
			<div style="margin-top: 50px; text-align: center;">
				<img class="mui-icon" style="height: 20%;width:20%" src="images/dcmp.jpg">
				<!--<span class="mui-icon mui-icon-person" style="font-size: 4em; border: 2px solid gray; border-radius: 50%; color: gray;"></span>-->
			</div>
			<div class="mui-card" style="margin-top: 50px;">
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label><span class="mui-icon mui-icon-personadd"></span></label>
						<select id="identity">
							<option value="financial">财务科</option>
							<option value="trainees_management">学员管理科</option>
							<option value="educational_management">教务管理科</option>
							<option value="classteacher">班主任</option>
							<option value="student">学员</option>
						</select>
					</div>
					<div class="mui-input-row">
						<label><span class="mui-icon mui-icon-contact"></span></label>
						<input id='account' type="text" class="mui-input-clear mui-input" placeholder="请输入身份证号">
					</div>
					<div class="mui-input-row">
						<label><span class="mui-icon mui-icon-locked"></span></label>
						<input id='password' type="password" class="mui-input-clear mui-input" placeholder="请输入密码">
					</div>
				</form>
			</div>
				<div class="mui-card" style="margin-top: 30px; border: 2px;">
				<ul class="mui-table-view mui-table-view-chevron">
					<li class="mui-table-view-cell">
						记住密码
						<div id="remember_btn" class="mui-switch mui-active">
							<div class="mui-switch-handle"></div>
						</div>
					</li>
				</ul>
			</div>
			<div class="mui-button-row" style="margin: 30px 15px;">
			<button id="loginBtn" type="button" class="mui-btn mui-btn-green own-btn-green mui-btn-block " style="padding: 10px 0px;">登录</button>
		    </div>
		    
		    <div class="link-area" style="text-align: center;margin-top: 10%;"><a id='reg' style="font-size: 15px;">注册账号</a> <span class="spliter"></div>
	<!--		<div class="mui-content-padded">
				<button id='login' class="mui-btn mui-btn-block mui-btn-primary">登录</button>
				<div class="link-area"><a id='reg'>注册账号</a> <span class="spliter">|</span> <a id='forgetPassword'>忘记密码</a>
				</div>
			</div>-->
		
		</div>
	<script src="js/mui.min.js"></script> 
	<script src="js/own.js" charset="UTF-8"></script>
    <script type="text/javascript" charset="utf-8">
	(function($) {
		//测试网络
		var network = true;
		if(mui.os.plus){
			mui.plusReady(function () {
				if(plus.networkinfo.getCurrentType()==plus.networkinfo.CONNECTION_NONE){
					network = false;
				}
			});
		}
		//设置全局beforeSend
		$.ajaxSettings.beforeSend = function(xhr, setting) {
			//beforeSend演示,也可在$.ajax({beforeSend:function(){}})中设置单个Ajax的beforeSend
			console.log('beforeSend:::' + JSON.stringify(setting));
		};
		//设置全局complete
		$.ajaxSettings.complete = function(xhr, status) {
			console.log('complete:::' + status);
		}
		
		var	account = document.querySelector('input[type="text"]');
		var	psd = document.querySelector('input[type="password"]');
		var	login = document.getElementById('loginBtn');
		var	regiser = document.getElementById('reg');		
		
		//var isRemember = localStorage.getItem("isRemember");//标志按钮最后状态
		var isRemember = true;
		document.getElementById("remember_btn").addEventListener('tap', function(event) {
          isRemember=!isRemember;
        });
		
		account.value = localStorage.getItem("account");
		psd.value = localStorage.getItem("psd");

      	//登陆的点击事件
		login.addEventListener('tap',function(){
			//账号密码检测不能为空
//			if (account.value.length != 18) {
//				mui.toast('未输入账号或者身份证账号格式不对！');
//				return;
//			}
//			if (psd.value.length <= 0) {
//				mui.toast('密码不能为空');
//				return;
//			}
//			localStorage.setItem("account",account.value);
//			if(isRemember)
//			{
//			    localStorage.setItem("psd",psd.value);
//			}
//			else
//			{
//				localStorage.removeItem("psd");
//			}
//			if(network){
//				     $.ajax({  
//                    url:'http://192.168.11.151/app/login', 
//                    data:{
//	                      card_id: account.value ,
//                        password: psd.value
//                  },  
//                    type:'post',  
//                    dataType:'json', 
//                    success:function(data) {  
//                    	console.log(data);
//                    	if(data != 0)
//                    	{
//                    	response_plan_str = JSON.stringify(data);                      	
//                    	console.log(response_plan_str);
//                    	 localStorage.setItem("account",account.value);
       	                  mui.openWindow({
                             url:'tab-webview-main.html',
                             id:'index'
                            }); 
//                    	}  else {
//                    	  mui.toast("请先注册账号！");
//                    	}                                      
//                     },  
//                     error : function() {    
//                       alert("网络请求异常！");  
//                     }  
//                  });
//	         }else{
//		     mui.toast("当前网络不给力，请稍后再试");
//	        }                    					
			//localStorage.setItem("isRemember",isRemember);			
		},false);		
		
		regiser.addEventListener('tap',function(){
			console.log("sss");
			$.openWindow({
                        url: 'tab-webview-main.html',
                        id: 'student',
                });
		},false);
		
	})(mui);
    </script>
	</body>
</html>
